<?php
class Slog_Controller
{
	protected $_params;
	
	protected $view;
	
	
	public function __construct($params)
	{
		$this->view = Slog::view();
		$this->_params = $params;
	}
	
	public function getParam($name, $default=null)
	{
		// Variables de URL
		for ($i=0; $i<count($this->_params); $i++) {
			if ($this->_params[$i] == $name) {
				return $this->_params[$i+1];
			}
		}
		
		// Variables POST/GET
		if (isset($_REQUEST[$name])) {
			return $_REQUEST[$name];
		}
		
		return $default;
	}
	
	public function redirect($uri)
	{
		$uri = "?q=$uri";
		header("Location: $uri");
		exit();
	}
	
}